package common.utils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
 * 
 * @author xuhai add 2014-12-10 09:44:13
 *
 */
public class DateUtil {
	
	private static SimpleDateFormat dayFormatter = new SimpleDateFormat("yyyy-MM-dd");
	
	public static SimpleDateFormat yyyymmddHHmmFormater = new SimpleDateFormat("yyyy-MM-dd HH:mm");
	
	public static String dateToString(Date date) {
		if(date==null)
			return "";
		SimpleDateFormat sdf = dayFormatter;
		String str = sdf.format(date);
		return str;
	}
	public static Date stringToDate(String date,String parten) throws ParseException{
		return new SimpleDateFormat(parten).parse(date);
	}
}
